package com.app.manage.config;

import org.springframework.beans.propertyeditors.StringTrimmerEditor;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.InitBinder;

/**
 * 全局请求参数格式化
 */
@ControllerAdvice

public class WebHttpParamTrimConf {

    @InitBinder
    public void initBinder(WebDataBinder binder) {
        // 自定义字符串转换器，去除前后空格
        binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
    }

}
